from flask import Flask,request,render_template,session,redirect

from reserch import reserch4letters

app = Flask(__name__)
app.secret_key = 'secret-key'


@app.route('/',methods=['GET'])
def hello_world():
    return render_template('hello.html')



@app.route('/name',methods=['GET'])
def name():
    return render_template('name.html')


@app.route('/submit_name',methods=['POST'])
def submit_name():

    firstName = request.form['firstName']
    lastName = request.form['lastName']
    fullName = lastName + firstName

    return render_template('name.html', first_name=firstName,last_name=lastName,
    full_name=fullName)



@app.route('/name',methods=['GET'])
def word():
    return render_template('name.html')



@app.route('/submit_word',methods=['POST'])
def submit_word():
    word = request.form['word']
    vowels = request.form['vowels']
    found = reserch4letters(vowels,word)

    num = 0
    for i in found:
        num = found[i]
    return render_template('name.html', num=num,word=word,vowels=vowels)



if __name__ == '__main__':
    app.run(host='127.0.0.1',port=5000,debug=True)
